home *** CD-ROM | disk | FTP | other *** search
/ Motor Sport Digital Archive Collection 1960s / Motor Sport Digital Archive Collection 1960s.iso / main.swf / scripts / views / TopNav.as < prev   
Encoding:
Text File  |  2008-05-21  |  9.9 KB  |  318 lines

  1. package views
  2. {
  3.    import events.NavigationEvent;
  4.    import events.ScreenEvent;
  5.    import flash.events.Event;
  6.    import flash.events.MouseEvent;
  7.    import flash.utils.getDefinitionByName;
  8.    import mx.binding.Binding;
  9.    import mx.binding.IWatcherSetupUtil;
  10.    import mx.containers.Canvas;
  11.    import mx.controls.Button;
  12.    import mx.controls.Image;
  13.    import mx.core.UIComponentDescriptor;
  14.    import mx.core.mx_internal;
  15.    import mx.events.PropertyChangeEvent;
  16.    
  17.    public class TopNav extends Canvas
  18.    {
  19.       private static var _watcherSetupUtil:IWatcherSetupUtil;
  20.       
  21.       private var _bindings:Array;
  22.       
  23.       [Bindable]
  24.       private var _607087477_Image1:Image;
  25.       
  26.       public var _bindingsByDestination:Object;
  27.       
  28.       public var _bindingsBeginWithWord:Object;
  29.       
  30.       private var logoClass:Class;
  31.       
  32.       [Bindable]
  33.       private var _1092797764closeBtn:Button;
  34.       
  35.       [Bindable]
  36.       private var _1551636857demoBtn:Button;
  37.       
  38.       private var _watchers:Array;
  39.       
  40.       [Bindable]
  41.       private var _975152270browseBtn:Button;
  42.       
  43.       [Bindable]
  44.       private var _1778179988searchBtn:Button;
  45.       
  46.       private var _documentDescriptor_:UIComponentDescriptor;
  47.       
  48.       public function TopNav()
  49.       {
  50.          _documentDescriptor_ = new UIComponentDescriptor({
  51.             "type":Canvas,
  52.             "propertiesFactory":function():Object
  53.             {
  54.                return {
  55.                   "width":1280,
  56.                   "height":45,
  57.                   "childDescriptors":[new UIComponentDescriptor({
  58.                      "type":Button,
  59.                      "id":"searchBtn",
  60.                      "events":{"click":"__searchBtn_click"},
  61.                      "propertiesFactory":function():Object
  62.                      {
  63.                         return {
  64.                            "buttonMode":true,
  65.                            "styleName":"topNavBtn",
  66.                            "label":"Search",
  67.                            "x":56,
  68.                            "y":9,
  69.                            "height":36
  70.                         };
  71.                      }
  72.                   }),new UIComponentDescriptor({
  73.                      "type":Button,
  74.                      "id":"demoBtn",
  75.                      "events":{"click":"__demoBtn_click"},
  76.                      "propertiesFactory":function():Object
  77.                      {
  78.                         return {
  79.                            "buttonMode":true,
  80.                            "styleName":"topNavBtn",
  81.                            "label":"Demo",
  82.                            "x":328,
  83.                            "y":9,
  84.                            "height":36
  85.                         };
  86.                      }
  87.                   }),new UIComponentDescriptor({
  88.                      "type":Button,
  89.                      "id":"browseBtn",
  90.                      "events":{"click":"__browseBtn_click"},
  91.                      "propertiesFactory":function():Object
  92.                      {
  93.                         return {
  94.                            "buttonMode":true,
  95.                            "styleName":"topNavBtn",
  96.                            "label":"Browse by Cover",
  97.                            "x":561,
  98.                            "y":9,
  99.                            "width":158,
  100.                            "height":36
  101.                         };
  102.                      }
  103.                   }),new UIComponentDescriptor({
  104.                      "type":Image,
  105.                      "id":"_Image1",
  106.                      "propertiesFactory":function():Object
  107.                      {
  108.                         return {
  109.                            "x":1065,
  110.                            "y":10
  111.                         };
  112.                      }
  113.                   }),new UIComponentDescriptor({
  114.                      "type":Button,
  115.                      "id":"closeBtn",
  116.                      "events":{"click":"__closeBtn_click"},
  117.                      "propertiesFactory":function():Object
  118.                      {
  119.                         return {
  120.                            "buttonMode":true,
  121.                            "styleName":"closeBtn",
  122.                            "label":"X",
  123.                            "x":1230,
  124.                            "y":9,
  125.                            "width":27,
  126.                            "height":25
  127.                         };
  128.                      }
  129.                   })]
  130.                };
  131.             }
  132.          });
  133.          logoClass = TopNav_logoClass;
  134.          super();
  135.          mx_internal::_document = this;
  136.          this.styleName = "topNav";
  137.          this.width = 1280;
  138.          this.height = 45;
  139.       }
  140.       
  141.       public static function set watcherSetupUtil(param1:IWatcherSetupUtil) : void
  142.       {
  143.          TopNav._watcherSetupUtil = param1;
  144.       }
  145.       
  146.       private function _TopNav_bindingsSetup() : void
  147.       {
  148.          var binding:Binding = null;
  149.          if(!_bindings)
  150.          {
  151.             _bindings = [];
  152.          }
  153.          if(!_watchers)
  154.          {
  155.             _watchers = [];
  156.          }
  157.          binding = new Binding(this,function():Object
  158.          {
  159.             return logoClass;
  160.          },function(param1:Object):void
  161.          {
  162.             _Image1.source = param1;
  163.          },"_Image1.source");
  164.          _bindings[0] = binding;
  165.       }
  166.       
  167.       private function clickHandler(param1:Event) : void
  168.       {
  169.          switch(param1.target)
  170.          {
  171.             case closeBtn:
  172.                trace("sending quit " + this);
  173.                dispatchEvent(new Event(ScreenEvent.QUIT,true));
  174.                break;
  175.             case searchBtn:
  176.                dispatchEvent(new NavigationEvent(NavigationEvent.SEARCH_TAB,null,true));
  177.                break;
  178.             case browseBtn:
  179.                dispatchEvent(new NavigationEvent(NavigationEvent.BROWSE_BY_COVER,null,true));
  180.                break;
  181.             case demoBtn:
  182.                dispatchEvent(new NavigationEvent(NavigationEvent.DEMO,null,true));
  183.          }
  184.       }
  185.       
  186.       public function __searchBtn_click(param1:MouseEvent) : void
  187.       {
  188.          clickHandler(param1);
  189.       }
  190.       
  191.       [Bindable(event="propertyChange")]
  192.       public function get closeBtn() : Button
  193.       {
  194.          return this._1092797764closeBtn;
  195.       }
  196.       
  197.       [Bindable(event="propertyChange")]
  198.       public function get demoBtn() : Button
  199.       {
  200.          return this._1551636857demoBtn;
  201.       }
  202.       
  203.       public function set closeBtn(param1:Button) : void
  204.       {
  205.          var _loc2_:Object = null;
  206.          _loc2_ = this._1092797764closeBtn;
  207.          if(_loc2_ !== param1)
  208.          {
  209.             this._1092797764closeBtn = param1;
  210.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"closeBtn",_loc2_,param1));
  211.          }
  212.       }
  213.       
  214.       public function __closeBtn_click(param1:MouseEvent) : void
  215.       {
  216.          clickHandler(param1);
  217.       }
  218.       
  219.       public function __browseBtn_click(param1:MouseEvent) : void
  220.       {
  221.          clickHandler(param1);
  222.       }
  223.       
  224.       public function set browseBtn(param1:Button) : void
  225.       {
  226.          var _loc2_:Object = null;
  227.          _loc2_ = this._975152270browseBtn;
  228.          if(_loc2_ !== param1)
  229.          {
  230.             this._975152270browseBtn = param1;
  231.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"browseBtn",_loc2_,param1));
  232.          }
  233.       }
  234.       
  235.       public function set demoBtn(param1:Button) : void
  236.       {
  237.          var _loc2_:Object = null;
  238.          _loc2_ = this._1551636857demoBtn;
  239.          if(_loc2_ !== param1)
  240.          {
  241.             this._1551636857demoBtn = param1;
  242.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"demoBtn",_loc2_,param1));
  243.          }
  244.       }
  245.       
  246.       public function set _Image1(param1:Image) : void
  247.       {
  248.          var _loc2_:Object = null;
  249.          _loc2_ = this._607087477_Image1;
  250.          if(_loc2_ !== param1)
  251.          {
  252.             this._607087477_Image1 = param1;
  253.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_Image1",_loc2_,param1));
  254.          }
  255.       }
  256.       
  257.       public function set searchBtn(param1:Button) : void
  258.       {
  259.          var _loc2_:Object = null;
  260.          _loc2_ = this._1778179988searchBtn;
  261.          if(_loc2_ !== param1)
  262.          {
  263.             this._1778179988searchBtn = param1;
  264.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"searchBtn",_loc2_,param1));
  265.          }
  266.       }
  267.       
  268.       public function __demoBtn_click(param1:MouseEvent) : void
  269.       {
  270.          clickHandler(param1);
  271.       }
  272.       
  273.       [Bindable(event="propertyChange")]
  274.       public function get browseBtn() : Button
  275.       {
  276.          return this._975152270browseBtn;
  277.       }
  278.       
  279.       override public function initialize() : void
  280.       {
  281.          var target:TopNav = null;
  282.          var watcherSetupUtilClass:Object = null;
  283.          mx_internal::setDocumentDescriptor(_documentDescriptor_);
  284.          _TopNav_bindingsSetup();
  285.          target = this;
  286.          if(_watcherSetupUtil == null)
  287.          {
  288.             watcherSetupUtilClass = getDefinitionByName("_views_TopNavWatcherSetupUtil");
  289.             watcherSetupUtilClass["init"](null);
  290.          }
  291.          _watcherSetupUtil.setup(this,function(param1:String):*
  292.          {
  293.             return target[param1];
  294.          },_bindings,_watchers);
  295.          super.initialize();
  296.       }
  297.       
  298.       [Bindable(event="propertyChange")]
  299.       public function get _Image1() : Image
  300.       {
  301.          return this._607087477_Image1;
  302.       }
  303.       
  304.       [Bindable(event="propertyChange")]
  305.       public function get searchBtn() : Button
  306.       {
  307.          return this._1778179988searchBtn;
  308.       }
  309.       
  310.       private function _TopNav_bindingExprs() : void
  311.       {
  312.          var _loc1_:* = undefined;
  313.          _loc1_ = logoClass;
  314.       }
  315.    }
  316. }
  317.  
  318.